package com.neo.service.statistics;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.io.UnsupportedEncodingException;
import java.util.*;

@Service
public class DjsStatisticsService {

    protected static Logger logger= LoggerFactory.getLogger(DjsStatisticsService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;


    public List<Map<String, Object>> query(String date) throws UnsupportedEncodingException {
/**
SELECT COUNT(*) AS 数量,SUM(loan_amt) AS 金额,STATUS AS 状态,LEFT(create_time,10) AS 时间
        FROM jx_invest_project WHERE create_time >'2018-03-06' GROUP BY  STATUS
**/
        String sql= " SELECT COUNT(*),SUM(loan_amt),STATUS,LEFT(create_time,10) FROM jx_invest_project WHERE create_time >'2018-03-06'  GROUP BY  STATUS ";
        List<Map<String, Object>> res = jdbcTemplate.queryForList(sql,date);
        return res;
    }


}